package com.kedi.evergreenschoolcenter.read.dao.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 
 *
 * @author: 	陈辽逊
 * @date: 		2019/7/13 10:40
 */
@Mapper
public interface CommunitysalonMapper {
		
	/**
	 * 					获取	社区沙龙数据表的所有数据
	 * @return			communitysalon
	 */
	@Select("SELECT c.communitysalon_id,c.sponsor,"
			+ "DATE_FORMAT(c.activetime, '%Y-%m-%d') as activetime,"
			+ "c.introduction,c.title,c.activeplace,c.limitnum,"
			+ "s.* "
			+ "FROM communitysalon c "
			+ "LEFT JOIN communitesource s "
			+ "on c.communitysalon_id = s.communitysalon_id")
	List<Map<String, Object>> communitysalon();		
	
	/**
	 * 					根据id获取社区沙龙报名电话
	 * @return			communitysalon
	 */	
	@Select("SELECT phone FROM  communitysalon WHERE communitysalon_id = (#{id})")
	int getcommunitysalonphone(@Param("id")int id);	
}
